package cn.kgc.springboot03.service.impl;

import cn.kgc.springboot03.entity.User;
import cn.kgc.springboot03.mapper.UserMapper;
import cn.kgc.springboot03.service.UserService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: 课工场
 * @Version: v1.0  2023/3/22
 * @Description:
 */
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;
    @Override
    public List<User> getList() {
        return   userMapper.getList();
    }

    @Override
    public List<User> getPage(Integer page, Integer limit) {

        PageHelper.startPage(page, limit);
        List<User> list = userMapper.getList();
        PageInfo<User> userPageInfo = new PageInfo<>(list);
        System.out.println("userPageInfo = " + userPageInfo);
        return list;
    }
}
